home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1999 July: Mac OS SDK / Dev.CD Jul 99 SDK1.toast / Development Kits / Mac OS / OpenGL 1.0 SDK / Source / Libraries / glut / glut_stroke.c < prev    next >
Encoding:
C/C++ Source or Header  |  1999-05-18  |  876 b   |  37 lines  |  [TEXT/CWIE]

  1.  
  2. /* Copyright (c) Mark J. Kilgard, 1994. */
  3.  
  4. /* This program is freely distributable without licensing fees
  5.    and is provided without guarantee or warrantee expressed or
  6.    implied. This program is -not- in the public domain. */
  7.  
  8. #include "glut.h"
  9. #include "glutint.h"
  10. #include "glutstroke.h"
  11.  
  12. void
  13. glutStrokeCharacter(GLUTstrokeFont font, int c)
  14. {
  15.   StrokeCharPtr ch;
  16.   StrokePtr stroke;
  17.   CoordPtr coord;
  18.   StrokeFontPtr fontinfo = (StrokeFontPtr) font;
  19.   int i, j;
  20.  
  21.   if (c < 0 || c >= fontinfo->num_chars)
  22.     return;
  23.   ch = &(fontinfo->ch[c]);
  24.   if (ch) {
  25.     for (i = ch->num_strokes, stroke = ch->stroke;
  26.       i > 0; i--, stroke++) {
  27.       glBegin(GL_LINE_STRIP);
  28.       for (j = stroke->num_coords, coord = stroke->coord;
  29.         j > 0; j--, coord++) {
  30.         glVertex2f(coord->x, coord->y);
  31.       }
  32.       glEnd();
  33.     }
  34.     glTranslatef(ch->right, 0.0, 0.0);
  35.   }
  36. }
  37.